// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    userInfo: null
  },
  getUserInfoAndLogin(e) {
    let that = this;
    wx.getUserProfile({
      desc: 'desc',
      success(res) {
        wx.login({
          success(res1) {
            wx.request({
              url: 'http://dil.aynakedu.com/api/Login',
              data: {
                'code': res1.code,
                'userInfo': res.userInfo
              },
              method: 'post',
              success(res2) {
                // console.log (res2);
                that.setData({
                  userInfo: res2.data.userInfo,
                })
              }
            });
          }
        })
      }
    })

  }

})